package book;

public class BookList {

    //通过数组方式组织存放书籍
    private Book[] books;

    //计数图书
    private int usedSize;//记录当前书架上，实际存放的书的 数量
    private static final int DEFAULT_CAPACITY = 10;//默认容量 为 10

    public BookList() {
        this.books = new Book[4];
        //书籍中存的是一本本书的对象
        this.books[0] = new Book("水浒传", "施耐庵", 10, "小说");
        this.books[1] = new Book("三国演义", "罗贯中", 12, "小说");
        this.books[2] = new Book("西游记", "吴承恩", 15, "小说");
        this.books[3] = new Book("红楼梦", "曹雪芹", 18, "小说");

        this.usedSize = 4;
    }

    public int getUsedSize() {
        return usedSize;
    }

    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }

    //通过下标获取书籍
    public Book getBooks(int pos) {
        return books[pos];
    }

    //通过下标设置数组中书籍
    public void setBooks(int pos, Book book) {
        books[pos] = book;
    }
    public Book[] getBooks() {
        return books;
    }

}
